<?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');
// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
    'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..',
    'name' => 'Web Application',
    // preloading 'log' component
    'preload' => array('log'),
    // autoloading model and component classes
    'import' => array(
        'application.models.*',
        'application.modules.user.models.*',
        'application.modules.user.components.*',
        'application.components.*',
        'application.helpers.*',
        'ext.giix-components.*', // giix components
    ),
    'modules' => array(
        'user' => array(
            'modules' => array(
                'role',
                'profiles',
                'messages',
            ),
            'debug' => 'true',
        ),
        // uncomment the following to enable the Gii tool
        'gii' => array(
            'class' => 'system.gii.GiiModule',
            'password' => 'admin',
            'generatorPaths' => array(
                'ext.giix-core', // giix generators
            ),
        ),
    ),
    // application components
    'components' => array(
        'user' => array(
            'class' => 'application.modules.user.components.WebUser',
            // enable cookie-based authentication
            'allowAutoLogin' => true,
            'loginUrl' => array('/user/user/login'),
        ),
        // uncomment the following to enable URLs in path-format

        'urlManager' => array(
            'urlFormat' => 'path',
            'rules' => array(
                array('api/error', 'pattern' => 'api/', 'verb' => 'GET'),
                array('api/error', 'pattern' => 'api/<functionality:\w+>', 'verb' => 'GET'),
                array('api/error', 'pattern' => 'api/', 'verb' => 'POST'),
                array('api/error', 'pattern' => 'api/<functionality:\w+>', 'verb' => 'POST'),
                array('api/list', 'pattern' => 'api/<functionality:\w+>/<action:\w+>', 'verb' => 'GET'),
                array('api/view', 'pattern' => 'api/<functionality:\w+>/<action:\w+>/<id:\d+>', 'verb' => 'GET'),
                array('api/update', 'pattern' => 'api/<functionality:\w+>/<action:\w+>/<id:\d+>', 'verb' => 'PUT'),
                array('api/delete', 'pattern' => 'api/<functionality:\w+>/<action:\w+>/<id:\d+>', 'verb' => 'DELETE'),
                array('api/create', 'pattern' => 'api/<functionality:\w+>/<action:\w+>', 'verb' => 'POST'),
                array('api/create', 'pattern' => 'api/<functionality:\w+>/<action:\w+>/<id:\d+>', 'verb' => 'POST'),
                '<controller:\w+>/<id:\d+>' => '<controller>/view',
                '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
                '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
            ),
        ),
        'image' => array(
                    'class' => 'application.extensions.image.CImageComponent',
                    'driver' => 'GD',
                ),
        'db' => array(
            'connectionString' => 'mysql:host=' . DB_SERVER . ';dbname=' . DB_NAME,
            'emulatePrepare' => true,
            'username' => DB_USER,
            'password' => DB_PASSWORD,
            'charset' => 'utf8',
            'tablePrefix' => 'aman_',
        ),
        'errorHandler' => array(
            // use 'site/error' action to display errors
            'errorAction' => 'site/error',
        ),
        'log' => array(
            'class' => 'CLogRouter',
            'routes' => array(
                array(
                    'class' => 'CFileLogRoute',
                    'levels' => 'error, warning',
                ),
            // uncomment the following to show log messages on web pages
            /*
              array(
              'class'=>'CWebLogRoute',
              ),
             */
            ),
        ),
    ),
    // application-level parameters that can be accessed
    // using Yii::app()->params['paramName']
    'params' => array(
        // this is used in contact page
        'adminEmail' => 'webmaster@example.com',
    ),
);